home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / misc / Hunk.lha / Hunk / Hoppers / HCE_NorthC.hop < prev    next >
Text File  |  1998-02-14  |  8KB  |  193 lines

  1. ;*************************************************************************
  2. ;** HCE 1.0 & NorthC 1.2 MUL(S)/DIV(S)/MOD(S)                           **
  3. ;** Contributor: L.Lucius                               Sept 23rd 1995  **
  4. ;** Modified for HOp:   Thomas Richter  (thor)          Nov  1st  1997  **
  5. ;** Function:    Modify 68000 math routines to use 68020+ instructions. **
  6. ;*************************************************************************
  7.  
  8.  
  9.  
  10. ;*************************************************************************
  11. ;
  12. ; Divs
  13. ;
  14. #match
  15. #code
  16. 202F 0004                       ;   MOVE.L      0004(A7),D0
  17. 6A02                            ;   BPL.B       0008
  18. 4480                            ;   NEG.L       D0
  19. 222F 0008                       ;   MOVE.L      0008(A7),D1
  20. 6A08                            ;   BPL.B       0016
  21. 4481                            ;   NEG.L       D1
  22. 0A2F 0080 0004                  ;   EORI.B      #80,0004(A7)
  23. 6100 008E                       ;   BSR.W       00A6
  24. 4A2F 0004                       ;   TST.B       0004(A7)
  25. 6A02                            ;   BPL.B       0022
  26. 4480                            ;   NEG.L       D0
  27. 4E75                            ;   RTS
  28. ;
  29. ; MULS()
  30. ;
  31. 202F 0004                       ;   MOVE.L      0004(A7),D0
  32. 6A02                            ;   BPL.B       002C
  33. 4480                            ;   NEG.L       D0
  34. 222F 0008                       ;   MOVE.L      0008(A7),D1
  35. 6A08                            ;   BPL.B       003A
  36. 4481                            ;   NEG.L       D1
  37. 0A2F 0080 0004                  ;   EORI.B      #80,0004(A7)
  38. 614E                            ;   BSR.B       008A
  39. 4A2F 0004                       ;   TST.B       0004(A7)
  40. 6A02                            ;   BPL.B       0044
  41. 4480                            ;   NEG.L       D0
  42. 4E75                            ;   RTS
  43. ;
  44. ; MODS()
  45. ;
  46. 202F 0004                       ;   MOVE.L      0004(A7),D0
  47. 6A02                            ;   BPL.B       004E
  48. 4480                            ;   NEG.L       D0
  49. 222F 0008                       ;   MOVE.L      0008(A7),D1
  50. 6A02                            ;   BPL.B       0056
  51. 4481                            ;   NEG.L       D1
  52. 614E                            ;   BSR.B       00A6
  53. 2001                            ;   MOVE.L      D1,D0
  54. 4A2F 0004                       ;   TST.B       0004(A7)
  55. 6A02                            ;   BPL.B       0062
  56. 4480                            ;   NEG.L       D0
  57. 4E75                            ;   RTS
  58. ;
  59. ; DIVU()
  60. ;
  61. 202F 0004                       ;   MOVE.L      0004(A7),D0
  62. 222F 0008                       ;   MOVE.L      0008(A7),D1
  63. 6138                            ;   BSR.B       00A6
  64. 4E75                            ;   RTS
  65. ;
  66. ; MULU()
  67. ;
  68. 202F 0004                       ;   MOVE.L      0004(A7),D0
  69. 222F 0008                       ;   MOVE.L      0008(A7),D1
  70. 6110                            ;   BSR.B       008A
  71. 4E75                            ;   RTS
  72. ;
  73. ; MODU()
  74. ;
  75. 202F 0004                       ;   MOVE.L      0004(A7),D0
  76. 222F 0008                       ;   MOVE.L      0008(A7),D1
  77. 6120                            ;   BSR.B       00A6
  78. 2001                            ;   MOVE.L      D1,D0
  79. 4E75                            ;   RTS
  80. XXXX                            ;   MOVEA.L     D3,A2    | MOVE.L D3,-(A7)
  81. 3401                            ;   MOVE.W      D1,D2
  82. C4C0                            ;   MULU.W      D0,D2
  83. 2601                            ;   MOVE.L      D1,D3
  84. 4843                            ;   SWAP        D3
  85. C6C0                            ;   MULU.W      D0,D3
  86. 4840                            ;   SWAP        D0
  87. C0C1                            ;   MULU.W      D1,D0
  88. D083                            ;   ADD.L       D3,D0
  89. 4840                            ;   SWAP        D0
  90. 4240                            ;   CLR.W       D0
  91. D082                            ;   ADD.L       D2,D0
  92. XXXX                            ;   MOVE.L      A2,D3    | MOVE.L (A7)+,D3
  93. 4E75                            ;   RTS
  94. 4A81                            ;   TST.L       D1
  95. 660E                            ;   BNE.B       00B8
  96. 80FC 0000                       ;   DIVU.W      #0000,D0
  97. 203C 8000 0000                  ;   MOVE.L      #80000000,D0
  98. 2200                            ;   MOVE.L      D0,D1
  99. 4E75                            ;   RTS
  100. XXXX                            ;   MOVEA.L     D3,A2    | MOVE.L D3,-(A7)
  101. B081                            ;   CMP.L       D1,D0
  102. 6212                            ;   BHI.B       00D0
  103. ;
  104. ;
  105. #replace
  106. ;
  107. ; DIVS()
  108. ;
  109. 202F 0004                       ;   MOVE.L      0004(A7),D0
  110. 222F 0008                       ;   MOVE.L      0008(A7),D1
  111. 4C41 0801                       ;   DIVSL.L     D1,D1:D0
  112. 4E75                            ;   RTS
  113. 4481                            ;   NEG.L       D1
  114. 0A2F 0080 0004                  ;   EORI.B      #80,0004(A7)
  115. 6100 008E                       ;   BSR.W       00A6
  116. 4A2F 0004                       ;   TST.B       0004(A7)
  117. 6A02                            ;   BPL.B       0022
  118. 4480                            ;   NEG.L       D0
  119. 4E75                            ;   RTS
  120. ;
  121. ; MULS()
  122. ;
  123. 202F 0004                       ;   MOVE.L      0004(A7),D0
  124. 4C2F 0800 0008                  ;   MULS.L      0008(A7),D0
  125. 4E75                            ;   RTS
  126. 6A08                            ;   BPL.B       003A
  127. 4481                            ;   NEG.L       D1
  128. 0A2F 0080 0004                  ;   EORI.B      #80,0004(A7)
  129. 614E                            ;   BSR.B       008A
  130. 4A2F 0004                       ;   TST.B       0004(A7)
  131. 6A02                            ;   BPL.B       0044
  132. 4480                            ;   NEG.L       D0
  133. 4E75                            ;   RTS
  134. ;
  135. ; MODS()
  136. ;
  137. 202F 0004                       ;   MOVE.L      0004(A7),D0
  138. 222F 0008                       ;   MOVE.L      0008(A7),D1
  139. 4C41 0801                       ;   DIVSL.L     D1,D1:D0
  140. C141                            ;   EXG         D0,D1
  141. 4E75                            ;   RTS
  142. 614E                            ;   BSR.B       00A6
  143. 2001                            ;   MOVE.L      D1,D0
  144. 4A2F 0004                       ;   TST.B       0004(A7)
  145. 6A02                            ;   BPL.B       0062
  146. 4480                            ;   NEG.L       D0
  147. 4E75                            ;   RTS
  148. ;
  149. ; DIVU()
  150. ;
  151. 202F 0004                       ;   MOVE.L      0004(A7),D0
  152. 222F 0008                       ;   MOVE.L      0008(A7),D1
  153. 6138                            ;   BSR.B       00A6
  154. 4E75                            ;   RTS
  155. ;
  156. ; MULU()
  157. ;
  158. 202F 0004                       ;   MOVE.L      0004(A7),D0
  159. 222F 0008                       ;   MOVE.L      0008(A7),D1
  160. 6110                            ;   BSR.B       008A
  161. 4E75                            ;   RTS
  162. ;
  163. ; MODU()
  164. ;
  165. 202F 0004                       ;   MOVE.L      0004(A7),D0
  166. 222F 0008                       ;   MOVE.L      0008(A7),D1
  167. 6120                            ;   BSR.B       00A6
  168. 2001                            ;   MOVE.L      D1,D0
  169. 4E75                            ;   RTS
  170. 4C01 0000                       ;   MULU.L      D1,D0
  171. 4E75                            ;   RTS
  172. 2601                            ;   MOVE.L      D1,D3
  173. 4843                            ;   SWAP        D3
  174. C6C0                            ;   MULU.W      D0,D3
  175. 4840                            ;   SWAP        D0
  176. C0C1                            ;   MULU.W      D1,D0
  177. D083                            ;   ADD.L       D3,D0
  178. 4840                            ;   SWAP        D0
  179. 4240                            ;   CLR.W       D0
  180. D082                            ;   ADD.L       D2,D0
  181. 260A                            ;   MOVE.L      A2,D3
  182. 4E75                            ;   RTS
  183. 4A81                            ;   TST.L       D1
  184. 660E                            ;   BNE.B       00B8
  185. 80FC 0000                       ;   DIVU.W      #0000,D0
  186. 203C 8000 0000                  ;   MOVE.L      #80000000,D0
  187. 2200                            ;   MOVE.L      D0,D1
  188. 4E75                            ;   RTS
  189. 4C41 0001                       ;   DIVUL.L     D1,D1:D0
  190. 4E75                            ;   RTS
  191. #end
  192.  
  193.